package com.jason.kotlin.gank.repository

import com.jason.kotlin.gank.api.ApiSource
import com.jason.kotlin.gank.api.RollService
import com.jason.kotlin.gank.model.*

/**
 * @description: RollApiImpl
 *
 * @author ChenBaoyang
 * @date 4/23/21 14:48
 */
class RollApiImpl : RollApi {

    private var service: RollService = ApiSource.getRollService(RollService::class.java)

    override suspend fun getQRCode(date: String?, type: Int): RollApiResponse<RollQRCodeBean?> =
        service.getQRCode(date, type)

    override suspend fun getHolidaySingle(date: String?): RollApiResponse<RollDayBean?> =
        service.getHolidaySingle(date)

    override suspend fun getJokeList(page: Int): RollApiResponse<RollPageApiResponse<RollJokeBean>> =
        service.getJokeList(page)

    override suspend fun getCityWeatherCurrentDays(cityName: String?): RollApiResponse<RollWeatherBean?> =
        service.getCityWeatherCurrentDays(cityName)

    override suspend fun getCityWeatherFutureDays(cityName: String?): RollApiResponse<RollForecastsBean> =
        service.getCityWeatherFutureDays(cityName)


    override suspend fun getHistoryToday(): RollApiResponse<List<RollHistoryBean>> =
        service.getHistoryToday()

    override suspend fun convertDictionary(content: String?): RollApiResponse<List<RollDictionaryBean>> =
        service.convertDictionary(content)

    override suspend fun getRubbishType(name: String?): RollApiResponse<RollRubbishBean> =
        service.getRubbishType(name)

    override suspend fun getMobileLocation(mobile: String?): RollApiResponse<RollMobileBean> =
        service.getMobileLocation(mobile)

    override suspend fun getIpLocationSelf(): RollApiResponse<RollIpBean?> =
        service.getIpLocationSelf()

    override suspend fun getIpLocation(ip: String?): RollApiResponse<RollIpBean?> =
        service.getIpLocation(ip)

    override suspend fun getWorldPhoneCode(): RollApiResponse<List<RollPhoneBean>> =
        service.getWorldPhoneCode()

    override suspend fun getNewsTypes(): RollApiResponse<List<RollNewsTypeBean>> =
        service.getNewsTypes()

    override suspend fun getNewsList(typeId: Int, page: Int): RollApiResponse<List<RollNewsInfoBean>> =
        service.getNewsList(typeId, page)

    override suspend fun getNewsDetail(newsId: Int): RollApiResponse<RollNewsDetailBean> =
        service.getNewsDetail(newsId)
}